home *** CD-ROM | disk | FTP | other *** search
- /*
- * (c) Copyright 1988 by
- * Robotics Principles Research Department, ATT Bell Laboratories.
- * All rights reserved.
- * Last modified 2/8/88 Ingemar J. Cox
- * C version 8/2/88 Deborah A. Wallach
- * Automatic thresholding 9/30/88 Ingemar J. Cox
- */
-
- #include <stdio.h>
- #include "edge_finder.h"
-
- extern struct image *my_image;
-
- int image_threshold()
- {
- int ix, iy, nx, ny;
- int *detx, tmp;
- float mad = 0; /* calculate mean absolute deviation */
-
- detx=my_image->idx;
- nx = my_image->nx;
- ny = my_image->ny;
-
- for(iy=0;iy<ny;iy++)
- {
- for(ix=0;ix<nx;ix++)
- {
- tmp = *detx++;
- mad += abs(tmp);
- }
- }
- return((int)((float)(3*mad/nx/ny)/0.8));
- }
-
-